﻿using System;
using System.Web.UI;
using SVTTranslateTextEngine.Core;

namespace SVTTranslateTextEngine.TestWeb
{
    public partial class TestApi : Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void btnTranslate_Click(object sender, EventArgs e)
        {
            var startDate = DateTime.Now;
            var translator = new TranslatorByGoogleHttp();

            var result = translator.GetTranslation(txtSrc.Text, ddlFrom.SelectedValue, ddlTo.SelectedValue);
            if (result != null)
                txtTrg.Text = result.Data.Translations[0].TranslatedText;

            lblMsg.Text = "Uses Time : [" + (DateTime.Now - startDate).TotalMilliseconds + "]ms";
            
            
        }
    }
}